// 通用组件样式

// 页面容器
.page-container {
  padding: $spacing-lg;
  
  @media (max-width: $breakpoint-sm) {
    padding: $spacing-md;
  }
}

// 页面标题
.page-title {
  font-size: $font-size-extra-large;
  font-weight: 600;
  color: $text-primary;
  margin-bottom: $spacing-lg;
  
  &.with-description {
    margin-bottom: $spacing-md;
    
    + .page-description {
      color: $text-secondary;
      font-size: $font-size-base;
      margin-bottom: $spacing-lg;
    }
  }
}

// 操作栏
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: $spacing-lg;
  
  .action-left {
    display: flex;
    align-items: center;
    gap: $spacing-md;
  }
  
  .action-right {
    display: flex;
    align-items: center;
    gap: $spacing-sm;
  }
  
  @media (max-width: $breakpoint-sm) {
    flex-direction: column;
    gap: $spacing-md;
    align-items: stretch;
    
    .action-left,
    .action-right {
      justify-content: center;
    }
  }
}

// 搜索栏
.search-bar {
  background: $bg-color;
  padding: $spacing-lg;
  border-radius: $border-radius-large;
  box-shadow: $box-shadow-light;
  margin-bottom: $spacing-lg;
  
  .el-form {
    .el-form-item {
      margin-bottom: 0;
      
      &:last-child {
        margin-left: auto;
      }
    }
  }
  
  @media (max-width: $breakpoint-sm) {
    padding: $spacing-md;
    
    .el-form {
      .el-form-item {
        margin-bottom: $spacing-md;
        
        &:last-child {
          margin-left: 0;
          margin-bottom: 0;
        }
      }
    }
  }
}

// 统计卡片
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: $spacing-lg;
  margin-bottom: $spacing-lg;
  
  .stat-card {
    .el-card__body {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: $spacing-lg;
    }
    
    .stat-content {
      .stat-number {
        font-size: $font-size-extra-large;
        font-weight: bold;
        color: $primary-color;
        margin-bottom: $spacing-xs;
      }
      
      .stat-label {
        font-size: $font-size-small;
        color: $text-secondary;
      }
    }
    
    .stat-icon {
      font-size: 32px;
      color: $border-light;
    }
  }
  
  @media (max-width: $breakpoint-sm) {
    grid-template-columns: repeat(2, 1fr);
    gap: $spacing-md;
  }
}

// 状态标签
.status-tag {
  &.status-success {
    background-color: lighten($success-color, 40%);
    color: $success-color;
    border: 1px solid lighten($success-color, 20%);
  }
  
  &.status-warning {
    background-color: lighten($warning-color, 40%);
    color: $warning-color;
    border: 1px solid lighten($warning-color, 20%);
  }
  
  &.status-danger {
    background-color: lighten($danger-color, 40%);
    color: $danger-color;
    border: 1px solid lighten($danger-color, 20%);
  }
  
  &.status-info {
    background-color: lighten($info-color, 40%);
    color: $info-color;
    border: 1px solid lighten($info-color, 20%);
  }
}

// 内容网格
.content-grid {
  display: grid;
  gap: $spacing-lg;
  
  &.grid-2 {
    grid-template-columns: 2fr 1fr;
    
    @media (max-width: $breakpoint-md) {
      grid-template-columns: 1fr;
    }
  }
  
  &.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    
    @media (max-width: $breakpoint-md) {
      grid-template-columns: 1fr;
    }
  }
}

// 数据表格
.data-table {
  background: $bg-color;
  border-radius: $border-radius-large;
  box-shadow: $box-shadow-light;
  overflow: hidden;
  
  .table-header {
    padding: $spacing-lg;
    border-bottom: 1px solid $border-lighter;
    background: $bg-light;
    
    h3 {
      margin: 0;
      font-size: $font-size-large;
      color: $text-primary;
    }
  }
  
  .el-table {
    border: none;
    
    &::before {
      display: none;
    }
  }
  
  .table-footer {
    padding: $spacing-md $spacing-lg;
    border-top: 1px solid $border-lighter;
    display: flex;
    justify-content: center;
  }
}

// 表单容器
.form-container {
  background: $bg-color;
  padding: $spacing-lg;
  border-radius: $border-radius-large;
  box-shadow: $box-shadow-light;
  
  .form-title {
    font-size: $font-size-large;
    font-weight: 600;
    color: $text-primary;
    margin-bottom: $spacing-lg;
    padding-bottom: $spacing-md;
    border-bottom: 1px solid $border-lighter;
  }
  
  .form-actions {
    margin-top: $spacing-lg;
    padding-top: $spacing-lg;
    border-top: 1px solid $border-lighter;
    text-align: right;
    
    .el-button {
      margin-left: $spacing-sm;
    }
    
    @media (max-width: $breakpoint-sm) {
      text-align: center;
      
      .el-button {
        margin: $spacing-xs;
        width: 120px;
      }
    }
  }
}

// 空状态
.empty-state {
  text-align: center;
  padding: $spacing-xl 0;
  
  .empty-icon {
    font-size: 64px;
    color: $border-light;
    margin-bottom: $spacing-lg;
  }
  
  .empty-title {
    font-size: $font-size-large;
    color: $text-regular;
    margin-bottom: $spacing-sm;
  }
  
  .empty-description {
    font-size: $font-size-base;
    color: $text-secondary;
    margin-bottom: $spacing-lg;
  }
}

// 加载状态
.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  
  .loading-text {
    margin-left: $spacing-sm;
    color: $text-secondary;
  }
}

// 错误状态
.error-container {
  text-align: center;
  padding: $spacing-xl 0;
  
  .error-icon {
    font-size: 64px;
    color: $danger-color;
    margin-bottom: $spacing-lg;
  }
  
  .error-title {
    font-size: $font-size-large;
    color: $text-primary;
    margin-bottom: $spacing-sm;
  }
  
  .error-message {
    font-size: $font-size-base;
    color: $text-secondary;
    margin-bottom: $spacing-lg;
  }
}

// 动画效果
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
  transition: transform 0.3s ease;
}

.slide-enter-from {
  transform: translateX(-100%);
}

.slide-leave-to {
  transform: translateX(100%);
}

// 打印样式
@media print {
  .no-print {
    display: none !important;
  }
  
  .page-container {
    padding: 0;
  }
  
  .el-card {
    box-shadow: none;
    border: 1px solid $border-base;
  }
}
